<!DOCTYPE html>
<html lang="zh-CN">
  <head><meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>


<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="theme-color" content="#f8f5ec" />
<meta name="msapplication-navbutton-color" content="#f8f5ec">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec">

<meta name="description" content="Typora 搭配gitee实现个人图床"/><link rel="alternate" href="/default" title="Hexo" ><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=2.11.1" />
<link rel="canonical" href="https://y_kvm.gitee.io/2022/02/21/Typora 搭配gitee实现个人图床/"/>

<link rel="stylesheet" type="text/css" href="/lib/fancybox/jquery.fancybox.css" /><script type="text/x-mathjax-config">
    MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });
  </script>
  <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<link rel="stylesheet" type="text/css" href="/css/style.css?v=2.11.1" />

<script id="baidu_analytics">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?9c3376609b4eb87c460cc9503d43f10e";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script><script src="//cdn1.lncld.net/static/js/3.1.1/av-min.js"></script>
  <script id="leancloud">
    AV.init({
      appId: "mhfJYrvbNrJ7wa3pFNWptaoe-MdYXbMMI",
      appKey: "IDppcTL9Rek0zfezfOeuICaF"
    });
  </script><script>
  window.config = {"leancloud":{"app_id":"mhfJYrvbNrJ7wa3pFNWptaoe-MdYXbMMI","app_key":"IDppcTL9Rek0zfezfOeuICaF"},"toc":true,"fancybox":true,"pjax":"","latex":true};
</script>

    <title>Typora 搭配gitee实现个人图床 - Hexo</title>
  <meta name="generator" content="Hexo 5.4.1"></head>

  <body><div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/." class="logo">Hexo</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>

<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list"><a href="/">
        <li class="mobile-menu-item">首页
          </li>
      </a><a href="/tags/">
        <li class="mobile-menu-item">标签
          </li>
      </a><a href="/about/">
        <li class="mobile-menu-item">关于
          </li>
      </a></ul>
</nav>
<div class="container" id="mobile-panel">
      <header id="header" class="header"><div class="logo-wrapper">
  <a href="/." class="logo">Hexo</a>
</div>

<nav class="site-navbar"><ul id="menu" class="menu"><li class="menu-item">
          <a class="menu-item-link" href="/">
            首页
            </a>
        </li>
      <li class="menu-item">
          <a class="menu-item-link" href="/tags/">
            标签
            </a>
        </li>
      <li class="menu-item">
          <a class="menu-item-link" href="/about/">
            关于
            </a>
        </li>
      </ul></nav>
</header>

      <main id="main" class="main">
        <div class="content-wrapper">
          <div id="content" class="content"><article class="post">
    <header class="post-header">
      <h1 class="post-title">Typora 搭配gitee实现个人图床
        </h1>

      <div class="post-meta">
        <span class="post-time">
          2022-02-21
        </span><span class="post-visits"
             data-url="/2022/02/21/Typora%20%E6%90%AD%E9%85%8Dgitee%E5%AE%9E%E7%8E%B0%E4%B8%AA%E4%BA%BA%E5%9B%BE%E5%BA%8A/"
             data-title="Typora 搭配gitee实现个人图床">
          阅读次数 0
        </span>
        </div>
    </header>

    <div class="post-toc" id="post-toc">
    <h2 class="post-toc-title">文章目录</h2>
    <div class="post-toc-content">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Typora-%E6%90%AD%E9%85%8Dgitee%E5%AE%9E%E7%8E%B0%E4%B8%AA%E4%BA%BA%E5%9B%BE%E5%BA%8A"><span class="toc-text">Typora 搭配gitee实现个人图床</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Picgo"><span class="toc-text">Picgo</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#picgo%E5%AE%89%E8%A3%85"><span class="toc-text">picgo安装</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#gitee%E6%8F%92%E4%BB%B6"><span class="toc-text">gitee插件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%87%8D%E5%91%BD%E5%90%8D%E6%8F%92%E4%BB%B6"><span class="toc-text">重命名插件</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9B%BE%E5%83%8F%E5%8E%8B%E7%BC%A9%E6%8F%92%E4%BB%B6%E2%80%94%E2%80%94compress"><span class="toc-text">图像压缩插件——compress</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#typora%E9%85%8D%E7%BD%AE"><span class="toc-text">typora配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Lesson"><span class="toc-text">Lesson</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%82%E8%80%83%E6%96%87%E6%A1%A3"><span class="toc-text">参考文档</span></a></li></ol></li></ol>
    </div>
  </div><div class="post-content"><h2 id="Typora-搭配gitee实现个人图床"><a href="#Typora-搭配gitee实现个人图床" class="headerlink" title="Typora 搭配gitee实现个人图床"></a>Typora 搭配gitee实现个人图床</h2><blockquote>
<p>System: Manjaro linux KDE 21.X</p>
<p>Computer: Dell Inspiring 7590</p>
<p>date: 2022-02-05</p>
</blockquote>
<h3 id="Picgo"><a href="#Picgo" class="headerlink" title="Picgo"></a>Picgo</h3><h4 id="picgo安装"><a href="#picgo安装" class="headerlink" title="picgo安装"></a>picgo安装</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S npm</span><br><span class="line">sudo npm install picgo -g </span><br></pre></td></tr></table></figure>

<blockquote>
<p>npm的安装逻辑在于默认安装到当前所在文件夹，添加-g后会安装到全局文件夹/usr/lib/node_modules,可执行文件添加到/usr/bin/下</p>
</blockquote>
<h4 id="gitee插件"><a href="#gitee插件" class="headerlink" title="gitee插件"></a>gitee插件</h4><ul>
<li>安装</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">picgo install gitee-uploader		</span><br></pre></td></tr></table></figure>

<ul>
<li>配置图床，</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">picgo <span class="built_in">set</span> uploader </span><br></pre></td></tr></table></figure>

<p>根据列出菜单选择gitee作为自动上传的默认图床</p>
<ul>
<li>设置gitee插件具体内容<ul>
<li>repo gitee账户名/具体仓库名称</li>
<li>branch 分支名称</li>
<li>token 登陆gitee个人设置-&gt;安全设置-&gt;私人令牌-&gt;生成新令牌（默认生成后的复制识别码，仅产生一次，后期需要可更新）</li>
<li>path 存储到仓库的什么位置采用 <strong>xxx/</strong> 的形式</li>
<li>customPath 存储到制定位置</li>
<li>costomUrl 和生成短链有关，没有默认空</li>
</ul>
</li>
</ul>
<h4 id="重命名插件"><a href="#重命名插件" class="headerlink" title="重命名插件"></a>重命名插件</h4><p>重命名插件为上传图片自动重命名，可以有效避免因为同一张图片上传因为名称相同的因素导致上传失败，这里推荐插件 <strong>super-prefix</strong>根据上传时间将图片名称和地址进行格式化</p>
<ul>
<li>安装插件</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">picgo install super-prefix</span><br></pre></td></tr></table></figure>

<ul>
<li>配置</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">picgo set plugin </span><br></pre></td></tr></table></figure>

<p>根据插件列表选择刚刚安装的 <strong>super-prefix</strong>进行格式化样式设定</p>
<ol>
<li>首先设置存储的前缀，及文件结构根据提示按照年月日或者年月或者年存储(注意以/结尾保证这是一个文件夹)<ul>
<li>YYYY/MM/DD/</li>
<li>YYYY/MM/</li>
<li>YYYY/</li>
</ul>
</li>
<li>接下来设置文件存储的格式其基本原理同上，以下为简单示例。<ul>
<li>YYYYMMDD-HHmm</li>
</ul>
</li>
</ol>
<h3 id="图像压缩插件——compress"><a href="#图像压缩插件——compress" class="headerlink" title="图像压缩插件——compress"></a>图像压缩插件——compress</h3><ul>
<li>新装的系统缺少部分编译工具的依赖库</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S libtool automake autoconf nasm</span><br></pre></td></tr></table></figure>

<ul>
<li>插件安装</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">picgo install compress</span><br></pre></td></tr></table></figure>

<ul>
<li>插件配置</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">picgo <span class="built_in">set</span> plugin </span><br></pre></td></tr></table></figure>

<p>选择compress 并配置为 ubanforgitee  （将所有图片压缩到1M以下,解决gitee的1M外链不能访问的问题.）其他选项见于参考文档</p>
<blockquote>
<p>super-prefix 重命名功能和此功能发生冲突，进而导致上传异常，如需使用compress可以配置其重命名功能，同时关闭super-prefix。推测这个和执行顺序有关，可以debug,但无确切思路</p>
</blockquote>
<h3 id="typora配置"><a href="#typora配置" class="headerlink" title="typora配置"></a>typora配置</h3><ol>
<li>文件-&gt;偏好设置-&gt;图像切换列表到上传图片</li>
<li>上传服务设定选择自定义命令（custom Command）命令如下</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/usr/bin/picgo upload </span><br></pre></td></tr></table></figure>

<p>typora在上述命令后会添加对应的图片地址，以将图片进行上传</p>
<blockquote>
<p>注意： gitee对于大于1M的文件需要登陆查看，所以这种方式目前不适用于大尺寸、高质量图片，需要进行压缩等处理，目前已解决部分问题，采用压缩的方式，但是无损目前仍村子啊问题</p>
</blockquote>
<h3 id="Lesson"><a href="#Lesson" class="headerlink" title="Lesson"></a>Lesson</h3><h3 id="参考文档"><a href="#参考文档" class="headerlink" title="参考文档"></a>参考文档</h3><p><a target="_blank" rel="noopener" href="https://www.npmjs.com/package/picgo-plugin-compress">picgo-plugin-compress</a></p>

      </div>
      <div class="post-copyright">
    <p class="copyright-item">
      <span>原文作者: </span>
      <a href="https://y_kvm.gitee.io">Explorer</a>
    </p>
    <p class="copyright-item">
      <span>原文链接: </span>
      <a href="https://y_kvm.gitee.io/2022/02/21/Typora%20%E6%90%AD%E9%85%8Dgitee%E5%AE%9E%E7%8E%B0%E4%B8%AA%E4%BA%BA%E5%9B%BE%E5%BA%8A/">https://y_kvm.gitee.io/2022/02/21/Typora%20%E6%90%AD%E9%85%8Dgitee%E5%AE%9E%E7%8E%B0%E4%B8%AA%E4%BA%BA%E5%9B%BE%E5%BA%8A/</a>
    </p>
    <p class="copyright-item">
      <span>许可协议: </span><a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/" target="_blank">知识共享署名-非商业性使用 4.0 国际许可协议</a>
    </p>
  </div>
      <footer class="post-footer">
        
        <nav class="post-nav"><a class="prev" href="/2022/02/21/ARM%20%20%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/">
        <i class="iconfont icon-left"></i>
        <span class="prev-text nav-default">ARM  环境配置</span>
        <span class="prev-text nav-mobile">上一篇</span>
      </a>
    <a class="next" href="/2022/02/21/%E5%88%9B%E5%BB%BA%E5%BF%AB%E6%8D%B7%E5%90%AF%E5%8A%A8/">
        <span class="next-text nav-default">创建快捷启动</span>
        <span class="prev-text nav-mobile">下一篇</span>
        <i class="iconfont icon-right"></i>
      </a>
    </nav></footer>
    </article></div><div class="comments" id="comments"></div></div>
      </main>

      <footer id="footer" class="footer"><div class="social-links"><a href="mailto:alternatingcurrenttesla@outlook.com" class="iconfont icon-email" title="email"></a>
        <a target="_blank" rel="noopener" href="https://github.com/KVM-Explorer" class="iconfont icon-github" title="github"></a>
        <a href="/atom.xml" class="iconfont icon-rss" title="rss"></a>
    </div><div class="copyright">
  <span class="power-by">
    由 <a class="hexo-link" target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a> 强力驱动
  </span>
  <span class="division">|</span>
  <span class="theme-info">
    主题 - 
    <a class="theme-link" target="_blank" rel="noopener" href="https://github.com/ahonn/hexo-theme-even">Even</a>
  </span>

  <span class="copyright-year">&copy;2015 - 2022<span class="heart">
      <i class="iconfont icon-heart"></i>
    </span>
    <span class="author">Explorer</span>
  </span>
</div>
</footer>

      <div class="back-to-top" id="back-to-top">
        <i class="iconfont icon-up"></i>
      </div>
    </div><script type="text/javascript" src="/lib/jquery/jquery.min.js"></script>
  <script type="text/javascript" src="/lib/slideout/slideout.js"></script>
  <script type="text/javascript" src="/lib/fancybox/jquery.fancybox.pack.js"></script>
  <script type="text/javascript" src="/js/src/even.js?v=2.11.1"></script>
</body>
</html>
